package com.google.code.coma.space;

import org.mozartspaces.capi3.Capi3Exception;
import org.mozartspaces.capi3.javanative.operation.NativeEntry;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @author Dominik Strasser, dominikstr@gmail.com
 */
public interface SelectorCallback extends Serializable {
	/**
	 * This method will be called within the (sub)transaction on the server and the callback can deal directly with
	 * the space entries.
	 *
	 * @param coordinatorCollection the entries in the ccordinator
	 * @param callContext		   the call context
	 * @return The list of entries which met the requirements of this callback
	 * @throws Capi3Exception in case of an error or CountNotMetException if the call cannot be completed yet.
	 */
	public List<NativeEntry> doInTransaction(Collection<NativeEntry> coordinatorCollection, CallContext callContext) throws Capi3Exception;
}
